<?php
namespace frontend\models;

use Yii;
use yii\behaviors\TimestampBehavior;
use yii\db\ActiveRecord;
use yii\db\Query;
use yii\web\IdentityInterface;


class HryOrder extends ActiveRecord
{
    public static function getDb()
    {
        return \Yii::$app->db2;  // 使用名为 "db2" 的应用组件,好融艺数据库链接
    }

    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%tf_order}}';
    }

    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return [
            TimestampBehavior::className(),
        ];
    }


    /**
     * 查询会员是否认投成功好融艺项目
     * @param $project_id
     * @param $member_id
     * @author hey_heyang(635870453@qq.com)
     * @return array
     */
    public function getHryMemberOrder($project_id,$member_id){
        $condition=['and',['project_id'=>$project_id,'uid'=>$member_id],['>','status',1]];
        $list=$this->find()->where($condition)->asArray()->one();
        return empty($list)?array():$list;

    }


}
